 //! @Author: DengLibin
 //! @Date: Create in 2024-04-02 13:45:25
 //! @Description: 
 //! 
 //! 
use html2text::from_read;

 /// @Author: DengLibin
 /// @Date: Create in 2024-04-02 13:45:32
 /// @Description: 移除html中的标签
pub fn remove_html_tags(html_text: &str) -> String {
    let text = from_read(html_text.as_bytes(), 80); // 设置行宽为80个字符，可以根据需要调整

    // 筛选文本内容部分并将多余的空格删除
    let cleaned_text = text.lines()
                          .filter(|line| !line.trim().is_empty())
                          .map(|line| line.trim())
                          .collect::<Vec<&str>>()
                          .join(" ");

    cleaned_text
}
